package io.xxx.xbutler.core.select.receiver;

import io.xxx.xbutler.domain.SelectMode;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class ReceiverSelectorFactory {

    @Resource
    private List<ReceiverSelector> selectors;

    public ReceiverSelector getSelector(SelectMode selectMode) {
        for (ReceiverSelector selector : selectors) {
            if (selector.supports(selectMode)) {
                return selector;
            }
        }
        return null;
    }
}
